<?php 
   class ViewModel
   {
      private $data = array();
      private $render = FALSE;
      public function __construct($template)
      {
         $file = $template.".php";
         //echo $file;//显示打开文件路径
         if(file_exists($file))
         {
            $this -> render = $file;
         }
      }
      public function assign($variable,$value)
      {
         $this -> data["$variable"] = $value;
      }
      public function display()
      {
         $data = $this -> data;
         include($this -> render);
      }
   }
 ?>